/*! \file
 * \brief Enter a brief description here.
 *
 * Enter a detailed description here. (optional)
 * \author Author (Ivo Wingelaar)
 * \date Date (2011)
 * \version Version (0.0.1)
 * \copyright Copyright (GNU LGPL v3)
 */

#ifndef __LYNX_FPS_COUNTER_HPP_INCLUDED__
#define __LYNX_FPS_COUNTER_HPP_INCLUDED__

#include "LynxConfig.hpp"

namespace Lynx
{

class FPSCounter
{
public:
    FPSCounter();

    //! returns current fps
    int32_t get_fps() const;

    //! returns primitive count
    uint32_t get_primitive() const;

    //! returns average primitive count of last period
    uint32_t get_primitive_average() const;

    //! returns accumulated primitive count since start
    uint32_t get_primitive_total() const;

    //! to be called every frame
    void register_frame(uint32_t now, uint32_t primitive);

private:
    int32_t mFPS;
    uint32_t mPrimitive;
    uint32_t mStartTime;

    uint32_t mFramesCounted;
    uint32_t mPrimitivesCounted;
    uint32_t mPrimitiveAverage;
    uint32_t mPrimitiveTotal;
};

} // namespace Lynx

#endif // __LYNX_FPS_COUNTER_HPP_INCLUDED__

